﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace WTable
{
    public class Col : ContentControl
    {
        public GridLength CWidth
        {
            get { return (GridLength)GetValue(CWidthProperty); }
            set { SetValue(CWidthProperty, value); }
        }
        public static readonly DependencyProperty CWidthProperty = DependencyProperty.Register("CWidth", typeof(GridLength), typeof(Col), new PropertyMetadata(new GridLength(1, GridUnitType.Star)));


        Pen pen = new Pen(Brushes.Black, 1);
        protected override void OnRender(DrawingContext dc)
        {
            base.OnRender(dc);
            //dc.DrawLine(pen, new Point(-1, RenderSize.Height), new Point(RenderSize.Width, RenderSize.Height));
            dc.DrawLine(pen, new Point(RenderSize.Width+.5, 0), new Point(RenderSize.Width + .5, RenderSize.Height));
            // drawingContext.DrawRectangle(Brushes.Transparent, new Pen(Brushes.Black, 1), new Rect(RenderSize));
        }

        protected override Size MeasureOverride(Size constraint)
        {
            return base.MeasureOverride(constraint);
        }

        protected override Size ArrangeOverride(Size arrangeSize)
        {
            return base.ArrangeOverride(arrangeSize);
        }

        //internal int GetLayoutCellCount(ColLayoutStatus status)
        //{
        //    var result = 0;

        //    if (Layout != null)
        //    {
        //        if (!IsFixed)
        //        {
        //            switch (status)
        //            {
        //                case ColLayoutStatus.Xs:
        //                    result = Layout.Xs;
        //                    break;
        //                case ColLayoutStatus.Sm:
        //                    result = Layout.Sm;
        //                    break;
        //                case ColLayoutStatus.Md:
        //                    result = Layout.Md;
        //                    break;
        //                case ColLayoutStatus.Lg:
        //                    result = Layout.Lg;
        //                    break;
        //                case ColLayoutStatus.Xl:
        //                    result = Layout.Xl;
        //                    break;
        //                case ColLayoutStatus.Xxl:
        //                    result = Layout.Xxl;
        //                    break;
        //                case ColLayoutStatus.Auto:
        //                    break;
        //                default:
        //                    throw new ArgumentOutOfRangeException(nameof(status), status, null);
        //            }
        //        }
        //    }
        //    else
        //    {
        //        result = Span;
        //    }

        //    return result;
        //}
    }
}
